home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / source / kernel / module.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-17  |  5.0 KB  |  130 lines  |  [TEXT/KAHL]

  1. /* Definitions for game modules in Xconq.
  2.    Copyright (C) 1991, 1992, 1993, 1994 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. /* A variant describes an option that is available to players starting
  10.    up a game, as well as modules including each other. */
  11.  
  12. typedef struct a_variant {
  13.     Obj *id;                    /* unique id */
  14.     char *name;                 /* displayable name */
  15.     Obj *dflt;                  /* default value */
  16.     Obj *range;                 /* description of range of values */
  17.     Obj *cases;                 /* actions to do on matches */
  18.     int used;                   /* true if the variant has been set to a value already */
  19. } Variant;
  20.  
  21. /* A file module records relevant info about the module, what it included,
  22.    how to write it out, etc. */
  23.  
  24. typedef struct a_module {
  25.     char *name;                 /* the actual unique name of the module */
  26.     char *title;                /* a readable display name */
  27.     char *blurb;                /* a descriptive one-liner */
  28.     char *picturename;          /* name of a descriptive image */
  29.     char *basemodulename;       /* name of the module that this one includes */
  30.     char *defaultbasemodulename;  /* what game to load if something missing */
  31.     char *basegame;             /* what general game this is based on */
  32.     Obj *instructions;          /* basic instructions */
  33.     Obj *notes;                 /* player notes */
  34.     Obj *designnotes;           /* designer notes */
  35.     char *version;              /* the version of this module */
  36.     char *programversion;       /* compatible program versions */
  37.     Variant *variants;          /* array of player-choosable variants */
  38.     char *contents;             /* a string with the actual contents */
  39.     char *sp;                   /* "string pointer" a la file pointer */
  40.     char *filename;             /* the filename */
  41.     FILE *fp;                   /* the stdio file buffer */
  42.     char *hook;                 /* space for system-specific file info */
  43.     int startlineno;            /* line number being read at start of form */
  44.     int endlineno;              /* line number being read at end of form */
  45.     int defall;
  46. #ifdef DESIGNERS
  47.     int readonly;               /* true if shouldn't be modified */
  48.     int deftypes;               /* flags indicating what to put in a module */
  49.     int deftables;
  50.     int defglobals;
  51.     int defscoring;
  52.     int defworld;
  53.     int defareas;
  54.     int defareaterrain;
  55.     int defareamisc;
  56.     int defareaweather;
  57.     int defareamaterial;
  58.     int defsides;
  59.     int defsideviews;
  60.     int defsidedoctrines;
  61.     int defplayers;
  62.     int defunits;
  63.     int defunitids;
  64.     int defunitprops;
  65.     int defunitacts;
  66.     int defunitplans;
  67.     int defhistory;
  68.     int compresslayers;
  69.     int maybereshape;
  70.     int subareawidth;
  71.     int subareaheight;
  72.     int subareax;
  73.     int subareay;
  74.     int finalsubareawidth;
  75.     int finalsubareaheight;
  76.     int finalsubareax;
  77.     int finalsubareay;
  78.     int finalwidth;
  79.     int finalheight;
  80.     int finalcircumference;
  81.     int filltype;
  82. #endif /* DESIGNERS */
  83.     int open;                  /* true if currently open */
  84.     int loaded;                /* true if already loaded */
  85.     struct a_module *next;      /* pointer to next module */
  86.     struct a_module *include;   /* pointer to first included module */
  87.     struct a_module *nextinclude;  /* pointer to next included module */
  88.     struct a_module *lastinclude;  /* pointer to last included module */
  89. } Module;
  90.  
  91. /* Iteration over the list of modules. */
  92.  
  93. #define for_all_modules(m)  \
  94.   for (m = modulelist; m != NULL; m = m->next)
  95.  
  96. #define for_all_includes(m,sub)  \
  97.   for (sub = m->include; sub != NULL; sub = sub->nextinclude)
  98.  
  99. extern Module *modulelist;
  100. extern Module *mainmodule;
  101.  
  102. /* Declarations of module functions. */
  103.  
  104. extern void clear_game_modules PROTO ((void));
  105. extern Module *create_game_module PROTO ((char *name));
  106. extern Module *find_game_module PROTO ((char *name));
  107. extern Module *get_game_module PROTO ((char *name));
  108. extern Module *add_game_module PROTO ((char *name, Module *includer));
  109. extern void describe_game_modules PROTO ((int arg, char *key, char *buf));
  110. extern void describe_game_module_aux PROTO ((char *buf, Module *module, int level));
  111. extern void describe_module_notes PROTO ((char *buf, Module *module));
  112. extern void load_default_game PROTO ((void));
  113. extern int load_game_description PROTO ((Module *module));
  114. extern void load_game_module PROTO ((Module *module, int dowarn));
  115. extern void load_base_module PROTO ((Module *module));
  116. extern int open_module PROTO ((Module *module, int dowarn));
  117. extern void read_forms PROTO ((Module *module));
  118. extern void init_module_reshape PROTO ((Module *module));
  119. extern int reshape_the_output PROTO ((Module *module));
  120. extern int valid_reshape PROTO ((Module *module));
  121. extern void close_module PROTO ((Module *module));
  122. extern char *module_desig PROTO ((Module *module));
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.